/*
 * INC.c
 *
 *  Created on: Jan 20, 2014
 *      Author: adijoshi
 */
//INCLUDES
#include "includes.h"


/*
 * Function: func_INC
 *
 * Inputs:	 Mnemonic, Address_of_destination
 * Outputs:  (None)
 * Condition  Codes:
 * 		Z:  set  if  result  =  0;  cleared  otherwise
 * 		N:  set  if  result  <  0;  cleared  otherwise
 * 		C:  not affected
 * 		V:  set  if  destination held 077777;  cleared otherwise.
 */

void func_INC(int mnemonic, unsigned short address_destination)
{
	unsigned short data,result;
	int result_32_bit;

	data = read_from_memory(address_destination,DATA);

	result_32_bit = 1 + data;
	result		  = (unsigned short)result_32_bit;

	write_in_memory(address_destination,result,DATA);

	update_N_flag(INC,result);
	update_Z_flag(result);
	update_V_flag(INC,data,0,result);
	// carry flag not affected
}




